#ifndef TCPSERVER_H
#define TCPSERVER_H

#include <QObject>

#include <QTcpServer>
#include <QTcpSocket>
#include <QDebug>

class TcpServer : public QObject
{
    Q_OBJECT
public:
    TcpServer(QObject *parent = nullptr);
    ~TcpServer();

    bool startServer(quint16 port);//开启服务器,并监听端口

private slots:
    void newConnection();
    void onReadyRead();
    void onDisconnected();

private:
    QTcpServer *server;

};

#endif // TCPSERVER_H
